﻿@using MvcApplication1.Models
@model List<News>
@{
    ViewBag.Title = "Add Image To News";
}

<h2>Add Image To News</h2>
@if (Model != null)
{

    <table id="table_admin">
        @foreach (News news in Model)
        {
            if (news.PublishDate == null)
            {
                <tr>
                    <td>@news.Title</td>
                    <td>@Html.ActionLink("Add images", "AddImageToNews", "Home", new {id = news.Id}, null)</td>
                </tr>
            }
        }
    </table>
    
}
else
{


if (ViewBag.Message != null)
 {
     @ViewBag.Message
 }
 else
 {

     using (Html.BeginForm("AddImageToNews", "Home", FormMethod.Post, new {enctype = "multipart/form-data"}))
     {
         <table>
             <tr>
                 <td colspan="2">
                     <input type="file" name="fileUpload[0]" id="upload1" /><br/>
                     <input type="file" name="fileUpload[1]" id="upload2" /><br/>
                     <input type="file" name="fileUpload[2]" id="upload3" /><br/>
                     <input type="file" name="fileUpload[3]" id="upload4" /><br/>
                     <input type="file" name="fileUpload[4]" id="upload5" />
                 </td>
             </tr>
             <tr>
                 <td>
                     <input type="submit" name="subAddFile" value="Add"/>
                 </td>
             </tr>
         </table>
     }
 }
}